// $ANTLR 3.2 Sep 23, 2009 12:02:23 /home/luis/AnGEMC/src/grammarGrammar/graalTree.g 2010-05-09 14:57:36

 import pt.our.angemc.datatypes.*;


import org.antlr.runtime.*;
import org.antlr.runtime.tree.*;import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

public class graalTree extends TreeParser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "TERMINAL", "NTERMINAL", "ELEMENT", "ALTERNATIVE", "RESERVED", "SIGN", "SEQUENCE", "TERMINALT", "NTERMINALT", "RESERVEDT", "SIGNT", "SEQUENCET", "OTHER", "OTHERT", "ATSIN", "ATSOUT", "ID", "STRING", "DOLARID", "ESC_SEQ", "HEX_DIGIT", "UNICODE_ESC", "OCTAL_ESC", "WS", "':'", "';'", "'returns'", "'['", "','", "']'", "'|'", "'~'", "'('", "')'", "'*'", "'+'", "'?'", "'..'"
    };
    public static final int SIGN=9;
    public static final int T__40=40;
    public static final int DOLARID=22;
    public static final int T__41=41;
    public static final int SIGNT=14;
    public static final int T__29=29;
    public static final int T__28=28;
    public static final int OTHER=16;
    public static final int TERMINAL=4;
    public static final int TERMINALT=11;
    public static final int UNICODE_ESC=25;
    public static final int OCTAL_ESC=26;
    public static final int HEX_DIGIT=24;
    public static final int ATSIN=18;
    public static final int NTERMINALT=12;
    public static final int ID=20;
    public static final int EOF=-1;
    public static final int T__30=30;
    public static final int SEQUENCE=10;
    public static final int T__31=31;
    public static final int T__32=32;
    public static final int T__33=33;
    public static final int SEQUENCET=15;
    public static final int ESC_SEQ=23;
    public static final int WS=27;
    public static final int T__34=34;
    public static final int T__35=35;
    public static final int RESERVED=8;
    public static final int T__36=36;
    public static final int T__37=37;
    public static final int NTERMINAL=5;
    public static final int T__38=38;
    public static final int T__39=39;
    public static final int RESERVEDT=13;
    public static final int ELEMENT=6;
    public static final int ALTERNATIVE=7;
    public static final int ATSOUT=19;
    public static final int OTHERT=17;
    public static final int STRING=21;

    // delegates
    // delegators


        public graalTree(TreeNodeStream input) {
            this(input, new RecognizerSharedState());
        }
        public graalTree(TreeNodeStream input, RecognizerSharedState state) {
            super(input, state);
             
        }
        

    public String[] getTokenNames() { return graalTree.tokenNames; }
    public String getGrammarFileName() { return "/home/luis/AnGEMC/src/grammarGrammar/graalTree.g"; }


     public Multiplier getMultiplier(String c)
     {
      Multiplier m = null;
      
      if(c.equals("*")){ m = Multiplier.STAR; }
      else{ 
           if(c.equals("?")){m = Multiplier.QUESTION;}
            else{ 
                 if(c.equals("+")){m = Multiplier.PLUS;}
                  else{ 
                     if(c.equals("' '")){m = Multiplier.NONE;}
                      }  
                }
          }               
      return m;
     } 
     
     public Symbol criaSymbol(int flag,String mult,String simb,ArrayList<Production> simbs,ArrayList<String> atribs)
     {
      Symbol s = null;
      switch(flag)
      {
       	case 0 : s = criaTerminal(mult,"var",simb);break;
       	case 1 : s = criaNterminal(mult,simb,atribs);break;
       	case 2 : s = criaTerminal(mult,"res",simb);break;
       	case 3 : s = criaTerminal(mult,"sin",simb);break;
       	case 4 : s = criaSeq(mult,simbs);break;
       	case 5 : s = criaAlt(mult,simbs);break;
       	case 6 : s = criaTerminal(mult,"seq",simb);break;
       	default: break;
      }  
     return s;
     }
     
     public Terminal criaTerminal(String mult,String s, String simb)
     {
      Terminal t = null;
      
      if(s.equals("var")) { t = new Terminal(simb,getMultiplier(mult),TerminalType.OTHER,false); }
       else{
            if(s.equals("res")) { t = new Terminal(simb,getMultiplier(mult),TerminalType.OTHER,false); }
            else{
                 if(s.equals("sin")) { t = new Terminal(simb,getMultiplier(mult),TerminalType.CHAR,false); }
                 else
                 {
                  if(s.equals("seq")) { t = new Terminal(simb,getMultiplier(mult),TerminalType.SEQUENCE,false); }
                 }
                 }
           }        
      
      return t;
     }
     
     public NonTerminal criaNterminal(String mult,String simb,ArrayList<String> atribs)
     {
      return new NonTerminal(simb,getMultiplier(mult),false,atribs); 
     }
     
     public SymbolsSequence criaSeq(String mult,ArrayList<Production> prods)
     {
      ArrayList<Symbol> simbs = new ArrayList<Symbol>();
      for(Production p : prods)
      {for(Symbol s : p.getSymbols())
       {simbs.add(s.clone());}} 
      return new SymbolsSequence(" ",getMultiplier(mult),simbs,false); 
     }
     
     public AlternativeSymbols criaAlt(String mult,ArrayList<Production> prods)
     {
      ArrayList<Symbol> simbs = new ArrayList<Symbol>();
      for(Production p : prods)
      {for(Symbol s : p.getSymbols())
       {simbs.add(s.clone());}} 
      return new AlternativeSymbols(" ",getMultiplier(mult),simbs,false); 
     }   



    // $ANTLR start "grammar_sq"
    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:92:1: grammar_sq returns [Grammar g] : (r= rule )+ ;
    public final Grammar grammar_sq() throws RecognitionException {
        Grammar g = null;

        Rule r = null;


        try {
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:93:3: ( (r= rule )+ )
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:94:3: (r= rule )+
            {
             g = new Grammar();
               ArrayList<Rule> regras = new ArrayList<Rule>();
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:96:3: (r= rule )+
            int cnt1=0;
            loop1:
            do {
                int alt1=2;
                int LA1_0 = input.LA(1);

                if ( ((LA1_0>=TERMINAL && LA1_0<=NTERMINAL)) ) {
                    alt1=1;
                }


                switch (alt1) {
            	case 1 :
            	    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:96:4: r= rule
            	    {
            	    pushFollow(FOLLOW_rule_in_grammar_sq61);
            	    r=rule();

            	    state._fsp--;

            	    regras.add(r);

            	    }
            	    break;

            	default :
            	    if ( cnt1 >= 1 ) break loop1;
                        EarlyExitException eee =
                            new EarlyExitException(1, input);
                        throw eee;
                }
                cnt1++;
            } while (true);

            g = new Grammar(regras);

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return g;
    }
    // $ANTLR end "grammar_sq"


    // $ANTLR start "rule"
    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:102:1: rule returns [Rule ruleOUT] : ( ^( TERMINAL i= identifier a= alternatives ) | ^( NTERMINAL i= identifier a= alternatives at= atributs ) );
    public final Rule rule() throws RecognitionException {
        Rule ruleOUT = null;

        String i = null;

        ArrayList<Production> a = null;

        graalTree.atributs_return at = null;


        try {
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:104:3: ( ^( TERMINAL i= identifier a= alternatives ) | ^( NTERMINAL i= identifier a= alternatives at= atributs ) )
            int alt2=2;
            int LA2_0 = input.LA(1);

            if ( (LA2_0==TERMINAL) ) {
                alt2=1;
            }
            else if ( (LA2_0==NTERMINAL) ) {
                alt2=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 2, 0, input);

                throw nvae;
            }
            switch (alt2) {
                case 1 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:104:6: ^( TERMINAL i= identifier a= alternatives )
                    {
                    match(input,TERMINAL,FOLLOW_TERMINAL_in_rule101); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_identifier_in_rule105);
                    i=identifier();

                    state._fsp--;

                    pushFollow(FOLLOW_alternatives_in_rule109);
                    a=alternatives();

                    state._fsp--;


                    match(input, Token.UP, null); 
                     
                          Terminal t = new Terminal(i, Multiplier.NONE, TerminalType.OTHER,false);
                          ruleOUT = new Rule(t,a,null,null);
                         

                    }
                    break;
                case 2 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:109:6: ^( NTERMINAL i= identifier a= alternatives at= atributs )
                    {
                    match(input,NTERMINAL,FOLLOW_NTERMINAL_in_rule127); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_identifier_in_rule131);
                    i=identifier();

                    state._fsp--;

                    pushFollow(FOLLOW_alternatives_in_rule135);
                    a=alternatives();

                    state._fsp--;

                    pushFollow(FOLLOW_atributs_in_rule139);
                    at=atributs();

                    state._fsp--;


                    match(input, Token.UP, null); 
                     
                          NonTerminal nt = new NonTerminal(i, Multiplier.NONE,false,null);
                          ruleOUT = new Rule(nt,a,(at!=null?at.atribsIN:null),(at!=null?at.atribsOUT:null));
                         

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return ruleOUT;
    }
    // $ANTLR end "rule"


    // $ANTLR start "identifier"
    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:116:1: identifier returns [String id] : ID ;
    public final String identifier() throws RecognitionException {
        String id = null;

        CommonTree ID1=null;

        try {
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:118:3: ( ID )
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:118:5: ID
            {
            ID1=(CommonTree)match(input,ID,FOLLOW_ID_in_identifier167); 
             id = (ID1!=null?ID1.getText():null); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return id;
    }
    // $ANTLR end "identifier"

    public static class atributs_return extends TreeRuleReturnScope {
        public ArrayList<Variable> atribsIN;
        public ArrayList<Variable> atribsOUT;
    };

    // $ANTLR start "atributs"
    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:121:1: atributs returns [ArrayList<Variable> atribsIN,ArrayList<Variable> atribsOUT] : ^( ATSIN (i= ats )? ) ^( ATSOUT (o= ats )? ) ;
    public final graalTree.atributs_return atributs() throws RecognitionException {
        graalTree.atributs_return retval = new graalTree.atributs_return();
        retval.start = input.LT(1);

        ArrayList<Variable> i = null;

        ArrayList<Variable> o = null;


        try {
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:123:3: ( ^( ATSIN (i= ats )? ) ^( ATSOUT (o= ats )? ) )
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:124:4: ^( ATSIN (i= ats )? ) ^( ATSOUT (o= ats )? )
            {
            match(input,ATSIN,FOLLOW_ATSIN_in_atributs194); 

            if ( input.LA(1)==Token.DOWN ) {
                match(input, Token.DOWN, null); 
                // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:124:12: (i= ats )?
                int alt3=2;
                int LA3_0 = input.LA(1);

                if ( (LA3_0==ID) ) {
                    alt3=1;
                }
                switch (alt3) {
                    case 1 :
                        // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:124:13: i= ats
                        {
                        pushFollow(FOLLOW_ats_in_atributs199);
                        i=ats();

                        state._fsp--;

                        retval.atribsIN = i;

                        }
                        break;

                }


                match(input, Token.UP, null); 
            }
            match(input,ATSOUT,FOLLOW_ATSOUT_in_atributs207); 

            if ( input.LA(1)==Token.DOWN ) {
                match(input, Token.DOWN, null); 
                // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:124:56: (o= ats )?
                int alt4=2;
                int LA4_0 = input.LA(1);

                if ( (LA4_0==ID) ) {
                    alt4=1;
                }
                switch (alt4) {
                    case 1 :
                        // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:124:57: o= ats
                        {
                        pushFollow(FOLLOW_ats_in_atributs212);
                        o=ats();

                        state._fsp--;

                        retval.atribsOUT = o;

                        }
                        break;

                }


                match(input, Token.UP, null); 
            }

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "atributs"


    // $ANTLR start "ats"
    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:127:1: ats returns [ArrayList<Variable> atribs] : (v= variable )+ ;
    public final ArrayList<Variable> ats() throws RecognitionException {
        ArrayList<Variable> atribs = null;

        Variable v = null;


        try {
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:129:3: ( (v= variable )+ )
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:129:4: (v= variable )+
            {
            atribs = new ArrayList<Variable>();
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:130:4: (v= variable )+
            int cnt5=0;
            loop5:
            do {
                int alt5=2;
                int LA5_0 = input.LA(1);

                if ( (LA5_0==ID) ) {
                    alt5=1;
                }


                switch (alt5) {
            	case 1 :
            	    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:130:5: v= variable
            	    {
            	    pushFollow(FOLLOW_variable_in_ats247);
            	    v=variable();

            	    state._fsp--;

            	     atribs.add(v);

            	    }
            	    break;

            	default :
            	    if ( cnt5 >= 1 ) break loop5;
                        EarlyExitException eee =
                            new EarlyExitException(5, input);
                        throw eee;
                }
                cnt5++;
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return atribs;
    }
    // $ANTLR end "ats"


    // $ANTLR start "variable"
    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:133:1: variable returns [Variable var] : t= ID n= ID ;
    public final Variable variable() throws RecognitionException {
        Variable var = null;

        CommonTree t=null;
        CommonTree n=null;

        try {
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:135:3: (t= ID n= ID )
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:135:5: t= ID n= ID
            {
            t=(CommonTree)match(input,ID,FOLLOW_ID_in_variable272); 
            n=(CommonTree)match(input,ID,FOLLOW_ID_in_variable276); 
            var = new Variable((t!=null?t.getText():null),(n!=null?n.getText():null));

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return var;
    }
    // $ANTLR end "variable"


    // $ANTLR start "alternatives"
    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:138:1: alternatives returns [ArrayList<Production> alts] : ( ^( ALTERNATIVE e= elements ) )+ ;
    public final ArrayList<Production> alternatives() throws RecognitionException {
        ArrayList<Production> alts = null;

        Production e = null;


        try {
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:140:3: ( ( ^( ALTERNATIVE e= elements ) )+ )
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:140:5: ( ^( ALTERNATIVE e= elements ) )+
            {
            alts = new ArrayList<Production>(); 
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:141:5: ( ^( ALTERNATIVE e= elements ) )+
            int cnt6=0;
            loop6:
            do {
                int alt6=2;
                int LA6_0 = input.LA(1);

                if ( (LA6_0==ALTERNATIVE) ) {
                    alt6=1;
                }


                switch (alt6) {
            	case 1 :
            	    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:141:6: ^( ALTERNATIVE e= elements )
            	    {
            	    match(input,ALTERNATIVE,FOLLOW_ALTERNATIVE_in_alternatives309); 

            	    match(input, Token.DOWN, null); 
            	    pushFollow(FOLLOW_elements_in_alternatives313);
            	    e=elements();

            	    state._fsp--;


            	         alts.add(e);
            	        

            	    match(input, Token.UP, null); 

            	    }
            	    break;

            	default :
            	    if ( cnt6 >= 1 ) break loop6;
                        EarlyExitException eee =
                            new EarlyExitException(6, input);
                        throw eee;
                }
                cnt6++;
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return alts;
    }
    // $ANTLR end "alternatives"


    // $ANTLR start "elements"
    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:148:1: elements returns [Production prod] : ( ^( ELEMENT e= element ) )+ ;
    public final Production elements() throws RecognitionException {
        Production prod = null;

        Symbol e = null;


        try {
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:150:3: ( ( ^( ELEMENT e= element ) )+ )
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:150:4: ( ^( ELEMENT e= element ) )+
            {
            ArrayList<Symbol> simbs = new ArrayList<Symbol>();
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:151:4: ( ^( ELEMENT e= element ) )+
            int cnt7=0;
            loop7:
            do {
                int alt7=2;
                int LA7_0 = input.LA(1);

                if ( (LA7_0==ELEMENT) ) {
                    alt7=1;
                }


                switch (alt7) {
            	case 1 :
            	    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:151:5: ^( ELEMENT e= element )
            	    {
            	    match(input,ELEMENT,FOLLOW_ELEMENT_in_elements355); 

            	    match(input, Token.DOWN, null); 
            	    pushFollow(FOLLOW_element_in_elements359);
            	    e=element();

            	    state._fsp--;

            	    simbs.add(e);

            	    match(input, Token.UP, null); 

            	    }
            	    break;

            	default :
            	    if ( cnt7 >= 1 ) break loop7;
                        EarlyExitException eee =
                            new EarlyExitException(7, input);
                        throw eee;
                }
                cnt7++;
            } while (true);

            prod = new Production(simbs);

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return prod;
    }
    // $ANTLR end "elements"


    // $ANTLR start "element"
    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:157:1: element returns [Symbol simb] : ( ^( TERMINAL s= single (m= multiplier )? ) | ^( TERMINALT s= single (m= multiplier )? ) | ^( NTERMINALT s= single (m= multiplier )? ) | ^( NTERMINAL s= single (m= multiplier )? ) | ^( RESERVED s= single (m= multiplier )? ) | ^( RESERVEDT s= single (m= multiplier )? ) | ^( SIGN s= single (m= multiplier )? ) | ^( SIGNT s= single (m= multiplier )? ) | ^( SEQUENCE a= alternatives (m= multiplier )? ) | ^( SEQUENCET a= alternatives (m= multiplier )? ) | ^( OTHER s= single (m= multiplier )? ) | ^( OTHERT s= single (m= multiplier )? ) | ^( OTHER a= alternatives (m= multiplier )? ) | ^( OTHERT alternatives (m= multiplier )? ) );
    public final Symbol element() throws RecognitionException {
        Symbol simb = null;

        graalTree.single_return s = null;

        String m = null;

        ArrayList<Production> a = null;



          int fl = 0;
         
        try {
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:163:3: ( ^( TERMINAL s= single (m= multiplier )? ) | ^( TERMINALT s= single (m= multiplier )? ) | ^( NTERMINALT s= single (m= multiplier )? ) | ^( NTERMINAL s= single (m= multiplier )? ) | ^( RESERVED s= single (m= multiplier )? ) | ^( RESERVEDT s= single (m= multiplier )? ) | ^( SIGN s= single (m= multiplier )? ) | ^( SIGNT s= single (m= multiplier )? ) | ^( SEQUENCE a= alternatives (m= multiplier )? ) | ^( SEQUENCET a= alternatives (m= multiplier )? ) | ^( OTHER s= single (m= multiplier )? ) | ^( OTHERT s= single (m= multiplier )? ) | ^( OTHER a= alternatives (m= multiplier )? ) | ^( OTHERT alternatives (m= multiplier )? ) )
            int alt22=14;
            alt22 = dfa22.predict(input);
            switch (alt22) {
                case 1 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:163:6: ^( TERMINAL s= single (m= multiplier )? )
                    {
                    match(input,TERMINAL,FOLLOW_TERMINAL_in_element412); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_single_in_element416);
                    s=single();

                    state._fsp--;

                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:163:27: (m= multiplier )?
                    int alt8=2;
                    int LA8_0 = input.LA(1);

                    if ( ((LA8_0>=38 && LA8_0<=40)) ) {
                        alt8=1;
                    }
                    switch (alt8) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:163:28: m= multiplier
                            {
                            pushFollow(FOLLOW_multiplier_in_element421);
                            m=multiplier();

                            state._fsp--;

                            fl = 1;

                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                    if(fl==1){simb = criaSymbol(0,m,(s!=null?s.id:null),null,null);}
                             else{simb = criaSymbol(0,"' '",(s!=null?s.id:null),null,null);}
                            

                    }
                    break;
                case 2 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:167:6: ^( TERMINALT s= single (m= multiplier )? )
                    {
                    match(input,TERMINALT,FOLLOW_TERMINALT_in_element445); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_single_in_element449);
                    s=single();

                    state._fsp--;

                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:167:28: (m= multiplier )?
                    int alt9=2;
                    int LA9_0 = input.LA(1);

                    if ( ((LA9_0>=38 && LA9_0<=40)) ) {
                        alt9=1;
                    }
                    switch (alt9) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:167:29: m= multiplier
                            {
                            pushFollow(FOLLOW_multiplier_in_element454);
                            m=multiplier();

                            state._fsp--;

                            fl = 1;

                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                    if(fl==1)
                             {Symbol sy = criaSymbol(0,m,(s!=null?s.id:null),null,null);
                              Terminal t = new Terminal("~", Multiplier.NONE, TerminalType.CHAR,false);
                              simb = new SymbolsSequence("", Multiplier.NONE, new ArrayList<Symbol>(),false);
                              ((SymbolsSequence)simb).addSymbol(t);
                              ((SymbolsSequence)simb).addSymbol(sy);
                             }
                             else{   
                              Symbol sy = criaSymbol(0,"' '",(s!=null?s.id:null),null,null);
                              Terminal t = new Terminal("~", Multiplier.NONE, TerminalType.CHAR,false);
                              simb = new SymbolsSequence("", Multiplier.NONE, new ArrayList<Symbol>(),false);
                              ((SymbolsSequence)simb).addSymbol(t);
                              ((SymbolsSequence)simb).addSymbol(sy);}
                                

                    }
                    break;
                case 3 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:182:6: ^( NTERMINALT s= single (m= multiplier )? )
                    {
                    match(input,NTERMINALT,FOLLOW_NTERMINALT_in_element480); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_single_in_element484);
                    s=single();

                    state._fsp--;

                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:182:29: (m= multiplier )?
                    int alt10=2;
                    int LA10_0 = input.LA(1);

                    if ( ((LA10_0>=38 && LA10_0<=40)) ) {
                        alt10=1;
                    }
                    switch (alt10) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:182:30: m= multiplier
                            {
                            pushFollow(FOLLOW_multiplier_in_element489);
                            m=multiplier();

                            state._fsp--;

                            fl = 1;

                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                    if(fl==1)
                             {Symbol sy = criaSymbol(1,m,(s!=null?s.id:null),null,(s!=null?s.atribs:null));
                              Terminal t = new Terminal("~", Multiplier.NONE, TerminalType.CHAR,false);
                              simb = new SymbolsSequence("", Multiplier.NONE, new ArrayList<Symbol>(),false);
                              ((SymbolsSequence)simb).addSymbol(t);
                              ((SymbolsSequence)simb).addSymbol(sy);
                             }
                             else{ 
                              Symbol sy = criaSymbol(1,"' '",(s!=null?s.id:null),null,(s!=null?s.atribs:null));
                              Terminal t = new Terminal("~", Multiplier.NONE, TerminalType.CHAR,false);
                              simb = new SymbolsSequence("", Multiplier.NONE, new ArrayList<Symbol>(),false);
                              ((SymbolsSequence)simb).addSymbol(t);
                              ((SymbolsSequence)simb).addSymbol(sy);
                              }
                            

                    }
                    break;
                case 4 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:198:6: ^( NTERMINAL s= single (m= multiplier )? )
                    {
                    match(input,NTERMINAL,FOLLOW_NTERMINAL_in_element514); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_single_in_element518);
                    s=single();

                    state._fsp--;

                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:198:28: (m= multiplier )?
                    int alt11=2;
                    int LA11_0 = input.LA(1);

                    if ( ((LA11_0>=38 && LA11_0<=40)) ) {
                        alt11=1;
                    }
                    switch (alt11) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:198:29: m= multiplier
                            {
                            pushFollow(FOLLOW_multiplier_in_element523);
                            m=multiplier();

                            state._fsp--;

                            fl = 1;

                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                    if(fl==1){simb = criaSymbol(1,m,(s!=null?s.id:null),null,(s!=null?s.atribs:null));}
                             else{ simb = criaSymbol(1,"' '",(s!=null?s.id:null),null,(s!=null?s.atribs:null));}

                    }
                    break;
                case 5 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:201:6: ^( RESERVED s= single (m= multiplier )? )
                    {
                    match(input,RESERVED,FOLLOW_RESERVED_in_element555); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_single_in_element559);
                    s=single();

                    state._fsp--;

                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:201:27: (m= multiplier )?
                    int alt12=2;
                    int LA12_0 = input.LA(1);

                    if ( ((LA12_0>=38 && LA12_0<=40)) ) {
                        alt12=1;
                    }
                    switch (alt12) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:201:28: m= multiplier
                            {
                            pushFollow(FOLLOW_multiplier_in_element564);
                            m=multiplier();

                            state._fsp--;

                            fl = 1;

                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                    if(fl==1){simb = criaSymbol(2,m,(s!=null?s.id:null),null,null);}
                             else{ simb = criaSymbol(2,"' '",(s!=null?s.id:null),null,null);}

                    }
                    break;
                case 6 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:204:6: ^( RESERVEDT s= single (m= multiplier )? )
                    {
                    match(input,RESERVEDT,FOLLOW_RESERVEDT_in_element587); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_single_in_element591);
                    s=single();

                    state._fsp--;

                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:204:28: (m= multiplier )?
                    int alt13=2;
                    int LA13_0 = input.LA(1);

                    if ( ((LA13_0>=38 && LA13_0<=40)) ) {
                        alt13=1;
                    }
                    switch (alt13) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:204:29: m= multiplier
                            {
                            pushFollow(FOLLOW_multiplier_in_element596);
                            m=multiplier();

                            state._fsp--;

                            fl = 1;

                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                    if(fl==1)
                             {Symbol sy = criaSymbol(2,m,(s!=null?s.id:null),null,null);
                              Terminal t = new Terminal("~", Multiplier.NONE, TerminalType.CHAR,false);
                              simb = new SymbolsSequence("", Multiplier.NONE, new ArrayList<Symbol>(),false);
                              ((SymbolsSequence)simb).addSymbol(t);
                              ((SymbolsSequence)simb).addSymbol(sy);
                             }
                             else{ 
                              Symbol sy = criaSymbol(2,"' '",(s!=null?s.id:null),null,null);
                              Terminal t = new Terminal("~", Multiplier.NONE, TerminalType.CHAR,false);
                              simb = new SymbolsSequence("", Multiplier.NONE, new ArrayList<Symbol>(),false);
                              ((SymbolsSequence)simb).addSymbol(t);
                              ((SymbolsSequence)simb).addSymbol(sy);
                              }
                              

                    }
                    break;
                case 7 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:220:6: ^( SIGN s= single (m= multiplier )? )
                    {
                    match(input,SIGN,FOLLOW_SIGN_in_element626); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_single_in_element630);
                    s=single();

                    state._fsp--;

                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:220:23: (m= multiplier )?
                    int alt14=2;
                    int LA14_0 = input.LA(1);

                    if ( ((LA14_0>=38 && LA14_0<=40)) ) {
                        alt14=1;
                    }
                    switch (alt14) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:220:24: m= multiplier
                            {
                            pushFollow(FOLLOW_multiplier_in_element635);
                            m=multiplier();

                            state._fsp--;

                            fl = 1;

                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                    if(fl==1){simb = criaSymbol(3,m,(s!=null?s.id:null),null,null);}
                             else{ simb = criaSymbol(3,"' '",(s!=null?s.id:null),null,null);}

                    }
                    break;
                case 8 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:223:6: ^( SIGNT s= single (m= multiplier )? )
                    {
                    match(input,SIGNT,FOLLOW_SIGNT_in_element659); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_single_in_element663);
                    s=single();

                    state._fsp--;

                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:223:24: (m= multiplier )?
                    int alt15=2;
                    int LA15_0 = input.LA(1);

                    if ( ((LA15_0>=38 && LA15_0<=40)) ) {
                        alt15=1;
                    }
                    switch (alt15) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:223:25: m= multiplier
                            {
                            pushFollow(FOLLOW_multiplier_in_element668);
                            m=multiplier();

                            state._fsp--;

                            fl = 1;

                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                    if(fl==1){
                              Symbol sy = criaSymbol(3,m,(s!=null?s.id:null),null,null);
                              Terminal t = new Terminal("~", Multiplier.NONE, TerminalType.CHAR,false);
                              simb = new SymbolsSequence("", Multiplier.NONE, new ArrayList<Symbol>(),false);
                              ((SymbolsSequence)simb).addSymbol(t);
                              ((SymbolsSequence)simb).addSymbol(sy);
                              }
                             else{ 
                              Symbol sy = criaSymbol(3,"' '",(s!=null?s.id:null),null,null);
                              Terminal t = new Terminal("~", Multiplier.NONE, TerminalType.CHAR,false);
                              simb = new SymbolsSequence("", Multiplier.NONE, new ArrayList<Symbol>(),false);
                              ((SymbolsSequence)simb).addSymbol(t);
                              ((SymbolsSequence)simb).addSymbol(sy);
                              }

                    }
                    break;
                case 9 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:238:6: ^( SEQUENCE a= alternatives (m= multiplier )? )
                    {
                    match(input,SEQUENCE,FOLLOW_SEQUENCE_in_element699); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_alternatives_in_element703);
                    a=alternatives();

                    state._fsp--;

                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:238:33: (m= multiplier )?
                    int alt16=2;
                    int LA16_0 = input.LA(1);

                    if ( ((LA16_0>=38 && LA16_0<=40)) ) {
                        alt16=1;
                    }
                    switch (alt16) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:238:34: m= multiplier
                            {
                            pushFollow(FOLLOW_multiplier_in_element708);
                            m=multiplier();

                            state._fsp--;

                            fl = 1;

                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                    if(fl==1){simb = criaSymbol(4,m,null,a,null);}
                             else{ simb = criaSymbol(4,"' '",null,a,null);}

                    }
                    break;
                case 10 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:241:6: ^( SEQUENCET a= alternatives (m= multiplier )? )
                    {
                    match(input,SEQUENCET,FOLLOW_SEQUENCET_in_element732); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_alternatives_in_element736);
                    a=alternatives();

                    state._fsp--;

                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:241:34: (m= multiplier )?
                    int alt17=2;
                    int LA17_0 = input.LA(1);

                    if ( ((LA17_0>=38 && LA17_0<=40)) ) {
                        alt17=1;
                    }
                    switch (alt17) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:241:35: m= multiplier
                            {
                            pushFollow(FOLLOW_multiplier_in_element741);
                            m=multiplier();

                            state._fsp--;

                            fl = 1;

                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                    if(fl==1){
                              Symbol sy = criaSymbol(4,m,null,a,null);
                              Terminal t = new Terminal("~", Multiplier.NONE, TerminalType.CHAR,false);
                              simb = new SymbolsSequence("", Multiplier.NONE, new ArrayList<Symbol>(),false);
                              ((SymbolsSequence)simb).addSymbol(t);
                              ((SymbolsSequence)simb).addSymbol(sy);
                              }
                             else{ 
                              Symbol sy = criaSymbol(4,"' '",null,a,null);
                              Terminal t = new Terminal("~", Multiplier.NONE, TerminalType.CHAR,false);
                              simb = new SymbolsSequence("", Multiplier.NONE, new ArrayList<Symbol>(),false);
                              ((SymbolsSequence)simb).addSymbol(t);
                              ((SymbolsSequence)simb).addSymbol(sy);
                              }

                    }
                    break;
                case 11 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:256:6: ^( OTHER s= single (m= multiplier )? )
                    {
                    match(input,OTHER,FOLLOW_OTHER_in_element773); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_single_in_element777);
                    s=single();

                    state._fsp--;

                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:256:24: (m= multiplier )?
                    int alt18=2;
                    int LA18_0 = input.LA(1);

                    if ( ((LA18_0>=38 && LA18_0<=40)) ) {
                        alt18=1;
                    }
                    switch (alt18) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:256:25: m= multiplier
                            {
                            pushFollow(FOLLOW_multiplier_in_element782);
                            m=multiplier();

                            state._fsp--;

                            fl = 1;

                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                    if(fl==1){simb = criaSymbol(6,m,(s!=null?s.id:null),null,null);}
                             else{simb = criaSymbol(6,"' '",(s!=null?s.id:null),null,null);}
                            

                    }
                    break;
                case 12 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:260:6: ^( OTHERT s= single (m= multiplier )? )
                    {
                    match(input,OTHERT,FOLLOW_OTHERT_in_element805); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_single_in_element809);
                    s=single();

                    state._fsp--;

                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:260:25: (m= multiplier )?
                    int alt19=2;
                    int LA19_0 = input.LA(1);

                    if ( ((LA19_0>=38 && LA19_0<=40)) ) {
                        alt19=1;
                    }
                    switch (alt19) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:260:26: m= multiplier
                            {
                            pushFollow(FOLLOW_multiplier_in_element814);
                            m=multiplier();

                            state._fsp--;

                            fl = 1;

                            }
                            break;

                    }


                    match(input, Token.UP, null); 

                             if(fl==1)
                             {Symbol sy = criaSymbol(6,m,(s!=null?s.id:null),null,null);
                              Terminal t = new Terminal("~", Multiplier.NONE, TerminalType.CHAR,false);
                              simb = new SymbolsSequence("", Multiplier.NONE, new ArrayList<Symbol>(),false);
                              ((SymbolsSequence)simb).addSymbol(t);
                              ((SymbolsSequence)simb).addSymbol(sy);
                             }
                             else{   
                              Symbol sy = criaSymbol(6,"' '",(s!=null?s.id:null),null,null);
                              Terminal t = new Terminal("~", Multiplier.NONE, TerminalType.CHAR,false);
                              simb = new SymbolsSequence("", Multiplier.NONE, new ArrayList<Symbol>(),false);
                              ((SymbolsSequence)simb).addSymbol(t);
                              ((SymbolsSequence)simb).addSymbol(sy);}
                                

                    }
                    break;
                case 13 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:276:6: ^( OTHER a= alternatives (m= multiplier )? )
                    {
                    match(input,OTHER,FOLLOW_OTHER_in_element837); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_alternatives_in_element841);
                    a=alternatives();

                    state._fsp--;

                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:276:30: (m= multiplier )?
                    int alt20=2;
                    int LA20_0 = input.LA(1);

                    if ( ((LA20_0>=38 && LA20_0<=40)) ) {
                        alt20=1;
                    }
                    switch (alt20) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:276:31: m= multiplier
                            {
                            pushFollow(FOLLOW_multiplier_in_element846);
                            m=multiplier();

                            state._fsp--;

                            fl = 1;

                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                    if(fl==1){simb = criaSymbol(5,m,null,a,null);}
                             else{ simb = criaSymbol(5,"' '",null,a,null);}

                    }
                    break;
                case 14 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:279:6: ^( OTHERT alternatives (m= multiplier )? )
                    {
                    match(input,OTHERT,FOLLOW_OTHERT_in_element871); 

                    match(input, Token.DOWN, null); 
                    pushFollow(FOLLOW_alternatives_in_element873);
                    alternatives();

                    state._fsp--;

                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:279:29: (m= multiplier )?
                    int alt21=2;
                    int LA21_0 = input.LA(1);

                    if ( ((LA21_0>=38 && LA21_0<=40)) ) {
                        alt21=1;
                    }
                    switch (alt21) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:279:30: m= multiplier
                            {
                            pushFollow(FOLLOW_multiplier_in_element878);
                            m=multiplier();

                            state._fsp--;

                            fl = 1;

                            }
                            break;

                    }


                    match(input, Token.UP, null); 
                    if(fl==1){
                              Symbol sy = criaSymbol(5,m,null,a,null);
                              Terminal t = new Terminal("~", Multiplier.NONE, TerminalType.CHAR,false);
                              simb = new SymbolsSequence("", Multiplier.NONE, new ArrayList<Symbol>(),false);
                              ((SymbolsSequence)simb).addSymbol(t);
                              ((SymbolsSequence)simb).addSymbol(sy);
                              }
                             else{ 
                              Symbol sy = criaSymbol(5,"' '",null,a,null);
                              Terminal t = new Terminal("~", Multiplier.NONE, TerminalType.CHAR,false);
                              simb = new SymbolsSequence("", Multiplier.NONE, new ArrayList<Symbol>(),false);
                              ((SymbolsSequence)simb).addSymbol(t);
                              ((SymbolsSequence)simb).addSymbol(sy);
                              }

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return simb;
    }
    // $ANTLR end "element"


    // $ANTLR start "multiplier"
    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:296:1: multiplier returns [String s] : (a= '*' | a= '+' | a= '?' );
    public final String multiplier() throws RecognitionException {
        String s = null;

        CommonTree a=null;

        try {
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:298:3: (a= '*' | a= '+' | a= '?' )
            int alt23=3;
            switch ( input.LA(1) ) {
            case 38:
                {
                alt23=1;
                }
                break;
            case 39:
                {
                alt23=2;
                }
                break;
            case 40:
                {
                alt23=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 23, 0, input);

                throw nvae;
            }

            switch (alt23) {
                case 1 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:298:5: a= '*'
                    {
                    a=(CommonTree)match(input,38,FOLLOW_38_in_multiplier925); 
                     s = (a!=null?a.getText():null);

                    }
                    break;
                case 2 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:299:5: a= '+'
                    {
                    a=(CommonTree)match(input,39,FOLLOW_39_in_multiplier935); 
                     s = (a!=null?a.getText():null);

                    }
                    break;
                case 3 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:300:5: a= '?'
                    {
                    a=(CommonTree)match(input,40,FOLLOW_40_in_multiplier945); 
                     s = (a!=null?a.getText():null);

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return s;
    }
    // $ANTLR end "multiplier"

    public static class single_return extends TreeRuleReturnScope {
        public String id;
        public ArrayList<String> atribs;
    };

    // $ANTLR start "single"
    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:303:1: single returns [String id,ArrayList<String> atribs] : (s= STRING ( '..' l= STRING )? | i= identifier (a= atribs )? );
    public final graalTree.single_return single() throws RecognitionException {
        graalTree.single_return retval = new graalTree.single_return();
        retval.start = input.LT(1);

        CommonTree s=null;
        CommonTree l=null;
        String i = null;

        ArrayList<String> a = null;


        try {
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:305:3: (s= STRING ( '..' l= STRING )? | i= identifier (a= atribs )? )
            int alt26=2;
            int LA26_0 = input.LA(1);

            if ( (LA26_0==STRING) ) {
                alt26=1;
            }
            else if ( (LA26_0==ID) ) {
                alt26=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 26, 0, input);

                throw nvae;
            }
            switch (alt26) {
                case 1 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:305:5: s= STRING ( '..' l= STRING )?
                    {
                    s=(CommonTree)match(input,STRING,FOLLOW_STRING_in_single970); 
                    retval.id = (s!=null?s.getText():null);
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:305:30: ( '..' l= STRING )?
                    int alt24=2;
                    int LA24_0 = input.LA(1);

                    if ( (LA24_0==41) ) {
                        alt24=1;
                    }
                    switch (alt24) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:305:31: '..' l= STRING
                            {
                            match(input,41,FOLLOW_41_in_single974); 
                            l=(CommonTree)match(input,STRING,FOLLOW_STRING_in_single978); 
                            retval.id += ".." + (l!=null?l.getText():null);

                            }
                            break;

                    }

                     retval.id.replace( "'", " " ); 

                    }
                    break;
                case 2 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:306:5: i= identifier (a= atribs )?
                    {
                    retval.atribs = new ArrayList<String>();
                    pushFollow(FOLLOW_identifier_in_single1000);
                    i=identifier();

                    state._fsp--;

                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:307:18: (a= atribs )?
                    int alt25=2;
                    int LA25_0 = input.LA(1);

                    if ( ((LA25_0>=ID && LA25_0<=DOLARID)) ) {
                        alt25=1;
                    }
                    switch (alt25) {
                        case 1 :
                            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:307:19: a= atribs
                            {
                            pushFollow(FOLLOW_atribs_in_single1005);
                            a=atribs();

                            state._fsp--;

                            retval.atribs = a; 

                            }
                            break;

                    }

                     retval.id = i;

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return retval;
    }
    // $ANTLR end "single"


    // $ANTLR start "atribs"
    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:310:1: atribs returns [ArrayList<String> atribs] : (v= var )+ ;
    public final ArrayList<String> atribs() throws RecognitionException {
        ArrayList<String> atribs = null;

        String v = null;


        try {
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:312:3: ( (v= var )+ )
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:312:5: (v= var )+
            {
            atribs = new ArrayList<String>();
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:313:5: (v= var )+
            int cnt27=0;
            loop27:
            do {
                int alt27=2;
                int LA27_0 = input.LA(1);

                if ( ((LA27_0>=ID && LA27_0<=DOLARID)) ) {
                    alt27=1;
                }


                switch (alt27) {
            	case 1 :
            	    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:313:6: v= var
            	    {
            	    pushFollow(FOLLOW_var_in_atribs1057);
            	    v=var();

            	    state._fsp--;

            	    atribs.add(v);

            	    }
            	    break;

            	default :
            	    if ( cnt27 >= 1 ) break loop27;
                        EarlyExitException eee =
                            new EarlyExitException(27, input);
                        throw eee;
                }
                cnt27++;
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return atribs;
    }
    // $ANTLR end "atribs"


    // $ANTLR start "var"
    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:316:1: var returns [String var] : (a= ID | a= STRING | a= DOLARID );
    public final String var() throws RecognitionException {
        String var = null;

        CommonTree a=null;

        try {
            // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:317:3: (a= ID | a= STRING | a= DOLARID )
            int alt28=3;
            switch ( input.LA(1) ) {
            case ID:
                {
                alt28=1;
                }
                break;
            case STRING:
                {
                alt28=2;
                }
                break;
            case DOLARID:
                {
                alt28=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 28, 0, input);

                throw nvae;
            }

            switch (alt28) {
                case 1 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:317:5: a= ID
                    {
                    a=(CommonTree)match(input,ID,FOLLOW_ID_in_var1081); 
                    var = (a!=null?a.getText():null);

                    }
                    break;
                case 2 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:317:30: a= STRING
                    {
                    a=(CommonTree)match(input,STRING,FOLLOW_STRING_in_var1089); 
                    var = (a!=null?a.getText():null);

                    }
                    break;
                case 3 :
                    // /home/luis/AnGEMC/src/grammarGrammar/graalTree.g:317:59: a= DOLARID
                    {
                    a=(CommonTree)match(input,DOLARID,FOLLOW_DOLARID_in_var1097); 
                    var = (a!=null?a.getText():null);

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }
        finally {
        }
        return var;
    }
    // $ANTLR end "var"

    // Delegated rules


    protected DFA22 dfa22 = new DFA22(this);
    static final String DFA22_eotS =
        "\23\uffff";
    static final String DFA22_eofS =
        "\23\uffff";
    static final String DFA22_minS =
        "\1\4\12\uffff\2\2\2\7\4\uffff";
    static final String DFA22_maxS =
        "\1\21\12\uffff\2\2\2\25\4\uffff";
    static final String DFA22_acceptS =
        "\1\uffff\1\1\1\2\1\3\1\4\1\5\1\6\1\7\1\10\1\11\1\12\4\uffff\1\15"+
        "\1\13\1\14\1\16";
    static final String DFA22_specialS =
        "\23\uffff}>";
    static final String[] DFA22_transitionS = {
            "\1\1\1\4\2\uffff\1\5\1\7\1\11\1\2\1\3\1\6\1\10\1\12\1\13\1\14",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "\1\15",
            "\1\16",
            "\1\17\14\uffff\2\20",
            "\1\22\14\uffff\2\21",
            "",
            "",
            "",
            ""
    };

    static final short[] DFA22_eot = DFA.unpackEncodedString(DFA22_eotS);
    static final short[] DFA22_eof = DFA.unpackEncodedString(DFA22_eofS);
    static final char[] DFA22_min = DFA.unpackEncodedStringToUnsignedChars(DFA22_minS);
    static final char[] DFA22_max = DFA.unpackEncodedStringToUnsignedChars(DFA22_maxS);
    static final short[] DFA22_accept = DFA.unpackEncodedString(DFA22_acceptS);
    static final short[] DFA22_special = DFA.unpackEncodedString(DFA22_specialS);
    static final short[][] DFA22_transition;

    static {
        int numStates = DFA22_transitionS.length;
        DFA22_transition = new short[numStates][];
        for (int i=0; i<numStates; i++) {
            DFA22_transition[i] = DFA.unpackEncodedString(DFA22_transitionS[i]);
        }
    }

    class DFA22 extends DFA {

        public DFA22(BaseRecognizer recognizer) {
            this.recognizer = recognizer;
            this.decisionNumber = 22;
            this.eot = DFA22_eot;
            this.eof = DFA22_eof;
            this.min = DFA22_min;
            this.max = DFA22_max;
            this.accept = DFA22_accept;
            this.special = DFA22_special;
            this.transition = DFA22_transition;
        }
        public String getDescription() {
            return "157:1: element returns [Symbol simb] : ( ^( TERMINAL s= single (m= multiplier )? ) | ^( TERMINALT s= single (m= multiplier )? ) | ^( NTERMINALT s= single (m= multiplier )? ) | ^( NTERMINAL s= single (m= multiplier )? ) | ^( RESERVED s= single (m= multiplier )? ) | ^( RESERVEDT s= single (m= multiplier )? ) | ^( SIGN s= single (m= multiplier )? ) | ^( SIGNT s= single (m= multiplier )? ) | ^( SEQUENCE a= alternatives (m= multiplier )? ) | ^( SEQUENCET a= alternatives (m= multiplier )? ) | ^( OTHER s= single (m= multiplier )? ) | ^( OTHERT s= single (m= multiplier )? ) | ^( OTHER a= alternatives (m= multiplier )? ) | ^( OTHERT alternatives (m= multiplier )? ) );";
        }
    }
 

    public static final BitSet FOLLOW_rule_in_grammar_sq61 = new BitSet(new long[]{0x0000000000000032L});
    public static final BitSet FOLLOW_TERMINAL_in_rule101 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_identifier_in_rule105 = new BitSet(new long[]{0x0000000000000080L});
    public static final BitSet FOLLOW_alternatives_in_rule109 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_NTERMINAL_in_rule127 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_identifier_in_rule131 = new BitSet(new long[]{0x0000000000000080L});
    public static final BitSet FOLLOW_alternatives_in_rule135 = new BitSet(new long[]{0x0000000000040000L});
    public static final BitSet FOLLOW_atributs_in_rule139 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_ID_in_identifier167 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ATSIN_in_atributs194 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_ats_in_atributs199 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_ATSOUT_in_atributs207 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_ats_in_atributs212 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_variable_in_ats247 = new BitSet(new long[]{0x0000000000100002L});
    public static final BitSet FOLLOW_ID_in_variable272 = new BitSet(new long[]{0x0000000000100000L});
    public static final BitSet FOLLOW_ID_in_variable276 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_ALTERNATIVE_in_alternatives309 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_elements_in_alternatives313 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_ELEMENT_in_elements355 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_element_in_elements359 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_TERMINAL_in_element412 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_single_in_element416 = new BitSet(new long[]{0x000001C000000008L});
    public static final BitSet FOLLOW_multiplier_in_element421 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_TERMINALT_in_element445 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_single_in_element449 = new BitSet(new long[]{0x000001C000000008L});
    public static final BitSet FOLLOW_multiplier_in_element454 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_NTERMINALT_in_element480 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_single_in_element484 = new BitSet(new long[]{0x000001C000000008L});
    public static final BitSet FOLLOW_multiplier_in_element489 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_NTERMINAL_in_element514 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_single_in_element518 = new BitSet(new long[]{0x000001C000000008L});
    public static final BitSet FOLLOW_multiplier_in_element523 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_RESERVED_in_element555 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_single_in_element559 = new BitSet(new long[]{0x000001C000000008L});
    public static final BitSet FOLLOW_multiplier_in_element564 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_RESERVEDT_in_element587 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_single_in_element591 = new BitSet(new long[]{0x000001C000000008L});
    public static final BitSet FOLLOW_multiplier_in_element596 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_SIGN_in_element626 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_single_in_element630 = new BitSet(new long[]{0x000001C000000008L});
    public static final BitSet FOLLOW_multiplier_in_element635 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_SIGNT_in_element659 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_single_in_element663 = new BitSet(new long[]{0x000001C000000008L});
    public static final BitSet FOLLOW_multiplier_in_element668 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_SEQUENCE_in_element699 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_alternatives_in_element703 = new BitSet(new long[]{0x000001C000000008L});
    public static final BitSet FOLLOW_multiplier_in_element708 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_SEQUENCET_in_element732 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_alternatives_in_element736 = new BitSet(new long[]{0x000001C000000008L});
    public static final BitSet FOLLOW_multiplier_in_element741 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_OTHER_in_element773 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_single_in_element777 = new BitSet(new long[]{0x000001C000000008L});
    public static final BitSet FOLLOW_multiplier_in_element782 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_OTHERT_in_element805 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_single_in_element809 = new BitSet(new long[]{0x000001C000000008L});
    public static final BitSet FOLLOW_multiplier_in_element814 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_OTHER_in_element837 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_alternatives_in_element841 = new BitSet(new long[]{0x000001C000000008L});
    public static final BitSet FOLLOW_multiplier_in_element846 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_OTHERT_in_element871 = new BitSet(new long[]{0x0000000000000004L});
    public static final BitSet FOLLOW_alternatives_in_element873 = new BitSet(new long[]{0x000001C000000008L});
    public static final BitSet FOLLOW_multiplier_in_element878 = new BitSet(new long[]{0x0000000000000008L});
    public static final BitSet FOLLOW_38_in_multiplier925 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_39_in_multiplier935 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_40_in_multiplier945 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_STRING_in_single970 = new BitSet(new long[]{0x0000020000000002L});
    public static final BitSet FOLLOW_41_in_single974 = new BitSet(new long[]{0x0000000000200000L});
    public static final BitSet FOLLOW_STRING_in_single978 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_identifier_in_single1000 = new BitSet(new long[]{0x0000000000700002L});
    public static final BitSet FOLLOW_atribs_in_single1005 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_var_in_atribs1057 = new BitSet(new long[]{0x0000000000700002L});
    public static final BitSet FOLLOW_ID_in_var1081 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_STRING_in_var1089 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_DOLARID_in_var1097 = new BitSet(new long[]{0x0000000000000002L});

}